using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class EventManager : MonoBehaviour
{
    public static EventManager Instance
    {
        get
        {
            if(instance == null)
            {
               instance = FindObjectOfType<EventManager>();
            }
            if(instance == null)
            {
                GameObject go = new GameObject("EventManagerObject");

                instance=go.AddComponent<EventManager>();

                DontDestroyOnLoad(go);
            }
            return instance;
        }
    }
    private static EventManager instance;

    public event Action ChangeSceneEvent;
    public void ChangeScene(int value,LoadSceneMode ls)
    {
        if(ChangeSceneEvent!=null)ChangeSceneEvent();
        
        SceneManager.LoadScene(value, ls);
    }

}
